package com.team1.supervend.state_machine;

public class AcceptingCreditCardForPaymentState implements State {

    SuperVend superVend;
    private float Amount = 0.0f;
    
    public AcceptingCreditCardForPaymentState(SuperVend superVend) {
        this.superVend = superVend;
    }

	@Override
	public void startSale() {
		System.out.println("startSale                   -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void cancelSale() {
		System.out.println("cancelSale                  -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void endSale() {
		System.out.println("endSale                     -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void returnToIdle() {
		System.out.println("returnToIdle                -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void preValidatePayment() {
		System.out.println("preValidatePayment          -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void payBalance() {
		System.out.println("payBalance                  -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void cancelPayment() {
		System.out.println("cancelPayment               -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void chooseCashPayment() {
		System.out.println("chooseCashPayment           -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void insertMoney(float denomination) {
		System.out.println("insertMoney($"+ denomination+")" );
	    Amount = Amount + denomination;
	}

	@Override
	public void makeCashPayment() {
		System.out.println("makeCashPayment             -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void supplyCreditCardInformation() {
		System.out.println("supplyCreditCardInformation -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void paymentAuthorized() {
		System.out.println("paymentAuthorized");
		if( Amount > 0.01f ) {
		   superVend.setState(superVend.getProcessingSaleState());
		}
	}

	@Override
	public void allowProductSelection() {
		System.out.println("allowProductSelection       -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void chooseProduct(int quantity) {
		System.out.println("chooseProduct               -- AcceptingCreditCardState -- do nothing");
	}

	@Override
	public void productSelectionComplete() {
		System.out.println("productSelectionComplete    -- AcceptingCreditCardState -- do nothing");
	}

	public String toString() {
		return "AcceptingCreditCardState";
	}
}
